#ifndef OSCARTYPES_H
#define OSCARTYPES_H

#include <QtCore>

namespace OSCAR
{
// Base types
typedef quint8  u08;
typedef quint16 u16;
typedef quint32 u32;
typedef float   f32;
typedef quint32 t70;

typedef struct
{
    unsigned char data5[6];
    unsigned char data4[2];
    unsigned short data3;
    unsigned short data2;
    unsigned long data1;
} UUID;

typedef void            empty;
//---------------------------------------------------------------------------

#pragma pack(push,1)

// Datatype: TLV
typedef struct
{
    u16 tag;
    u16 len;
} TLV__Header;

typedef enum
{
    FLAP_SIGNON_TAG_CLIENT_NAME         = 3,
    FLAP_SIGNON_TAG_LOGIN_COOKIE        = 6,
    FLAP_SIGNON_TAG_CLIENT_COUNTRY      = 14,
    FLAP_SIGNON_TAG_CLIENT_LANGUAGE     = 15,
    FLAP_SIGNON_TAG_MAJOR_VERSION       = 23,
    FLAP_SIGNON_TAG_MINOR_VERSION       = 24,
    FLAP_SIGNON_TAG_POINT_VERSION       = 25,
    FLAP_SIGNON_TAG_BUILD_NUM           = 26,
    FLAP_SIGNON_TAG_MULTICONN_FLAGS     = 74,
    FLAP_SIGNON_TAG_CLIENT_RECONNECT    = 148
} FLAP_SIGNON_TAGS;
//---------------------------------------------------------------------------

// FLAP - Frame Layer Protocol
typedef struct
{
    u08 startMarker;
    u08 frameType;
    u16 sequenceNumber;
    u16 payloadLength;
} FLAP__Header;

typedef enum
{
    FLAP__FRAME_TYPE_SIGNON      = 0x01,
    FLAP__FRAME_TYPE_DATA        = 0x02,
    FLAP__FRAME_TYPE_ERROR       = 0x03,
    FLAP__FRAME_TYPE_SIGNOFF     = 0x04,
    FLAP__FRAME_TYPE_KEEP_ALIVE  = 0x05
} FLAP__FRAME_TYPE;

typedef enum
{
    FLAP__MULTICONN_FLAGS_OLD_CLIENT      = 0x00,
    FLAP__MULTICONN_FLAGS_RECENT_CLIENT   = 0x01,
    FLAP__MULTICONN_FLAGS_SINGLE          = 0x02
} FLAP__MULTICONN_FLAGS;
//---------------------------------------------------------------------------

// SNAC - Simple Network Atomic Communication
typedef struct
{
    u16 foodgroup;
    u16 type;
} SNAC__ID;

typedef struct
{
    SNAC__ID id;
    u16 flags;
    u32 requestId;
} SNAC__Header;

typedef enum
{
    SNAC__HEADER_FLAG_OPT_TLV_PRESENT       = 0x8000,
    SNAC__HEADER_FLAG_MORE_REPLIES_FOLLOW   = 0x0001
} SNAC__HEADER_FLAGS;

typedef enum
{
    SNAC__FOODGROUP_OSERVICE        = 0x0001,
    SNAC__FOODGROUP_LOCATE          = 0x0002,
    SNAC__FOODGROUP_BUDDY           = 0x0003,
    SNAC__FOODGROUP_ICBM            = 0x0004,
    SNAC__FOODGROUP_ADVERTISEMENT   = 0x0005,
    SNAC__FOODGROUP_INVITE          = 0x0006,
    SNAC__FOODGROUP_ADMINISTRATIVE  = 0x0007,
    SNAC__FOODGROUP_POPUP           = 0x0008,
    SNAC__FOODGROUP_PD              = 0x0009,
    SNAC__FOODGROUP_LOOKUP          = 0x000a,
    SNAC__FOODGROUP_USAGE           = 0x000b,
    SNAC__FOODGROUP_TRANSLATION     = 0x000c,
    SNAC__FOODGROUP_CHAT_NAVIGATION = 0x000d,
    SNAC__FOODGROUP_CHAT            = 0x000e,
    SNAC__FOODGROUP_SEARCH          = 0x000f,
    SNAC__FOODGROUP_BART            = 0x0010,
    SNAC__FOODGROUP_FEEDBAG         = 0x0013,
    SNAC__FOODGROUP_ICQEXT          = 0x0015,
    SNAC__FOODGROUP_AUTH            = 0x0017,
    SNAC__FOODGROUP_BROADCAST       = 0x0085
} SNAC__FOODGROUP;
//---------------------------------------------------------------------------

typedef enum
{
    OSERVICE__SRV_GEN_ERROR         = 0x0001,
    OSERVICE__CLI_READY             = 0x0002,
    OSERVICE__SRV_FAMILIES          = 0x0003,
    OSERVICE__CLI_SERVICE_REQ       = 0x0004,
    OSERVICE__SRV_REDIRECT_SERVICE  = 0x0005,
    OSERVICE__CLI_RATES_REQUEST     = 0x0006,
    OSERVICE__SRV_RATE_LIMIT_INFO   = 0x0007,

    OSERVICE__SRV_ONLINE_INFO       = 0x000f,

    OSERVICE__WELLKNOWN_URLS        = 0x0015,

    OSERVICE__CLI_SET_STATUS        = 0x001e,

    OSERVICE__SRV_EXT_STATUS        = 0x0021
} OSERVICE_TYPES;
//---------------------------------------------------------------------------

typedef enum
{
    FEEDBAG__CLI_SSI_REQUEST        = 0x0004, // get server side contact list (SSI)
    FEEDBAG__CLI_SSI_CHECKOUT       = 0x0005, // Use this snac to check if your SSI local copy up-to-date (mod-time & items-num match). If not - server will send SSI via SNAC(13,06), overwise you'll receive SNAC(13,0F).
    FEEDBAG__SRV_SSI_REPLY          = 0x0006, // This is the server reply to client roster requests
    FEEDBAG__CLI_SSI_ACTIVATE       = 0x0007, // After this snac server start send presense notifications for you
    FEEDBAG__CLI_SSI_ADD            = 0x0008, // Client use this to add new items to server-side info. Server should reply via SNAC(13,0E).
    FEEDBAG__CLI_SSI_UPDATE         = 0x0009, // This can be used to modify either the name or additional data for any items that are already in your server-stored information
    FEEDBAG__CLI_SSI_EDIT_BEGIN     = 0x0011, // Contacts edit start (begin transaction)
    FEEDBAG__CLI_SSI_EDIT_END       = 0x0012, // Contacts edit end (finish transaction)
    FEEDBAG__SRV_SSI_UP_TO_DATE     = 0x000f, // Server send this snac as reply for SNAC(13,05) when server-stored information has the same modification date and items number.
} FEEDBAG_TYPES;
//---------------------------------------------------------------------------



#pragma pack(pop)

};

#endif // OSCARTYPES_H
